<template>
    <div class="wrap">
        
        <div class="block">
            <p>代发设置</p>
            <van-switch v-model="is_instead" active-color="#719BEF" active-value="1" inactive-value="0" size="24px" @change="setIns" />

        </div>
        <p class="title">根据您的服务性质选择是否提供该服务，开启后客户可正常提交代发，不开启则客户无法提交代发，同时向客户显示“该商家不提供代发服务”</p>
        <div class="block">
            <p>到货状态</p>
            <van-switch v-model="is_get" active-color="#719BEF"  active-value="1" inactive-value="0" size="24px" @change="setFGet" />

        </div>
        <p class="title">根据您的服务性质选择是否提供该服务，开启后在公众号商家端内修改订单到货状态时，向客户显示更变后的到货状态，不开启则客户到货状态为空白不显示。</p>
    </div>
</template>
<style scoped lang="scss">
.wrap{
    height: 100vh;
    background: #fafafa;
    overflow: hidden;
}
.block{
    background: #fff;
    width: 8.6rem;
    padding: 0 .4rem;
    margin: 15px auto;
    border-radius: .266667rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 1.2rem;
    p{
        color: #555;
        font-size: .48rem;
    }
}
.title{
    color: #999;
    font-size: .32rem;
    text-align: left;
    width: 8.6rem;
    margin: 0 auto;
}
</style>
<script>
import {updateInstead,findUserInfo,updateGet} from '@/utils/interface'
import { Toast } from 'vant';

export default {
    data(){
        return {
            is_instead:null,
            is_get:null
        }
    },
    methods:{
        findUserInfoa(){
            findUserInfo().then(res=>{
                this.is_instead = res.data.data.is_instead
                this.is_get = res.data.data.is_get
            })
        },
        setIns(e){
            this.is_instead=0
            Toast('暂未开放')
            return false
            updateInstead({is_instead:e}).then(res=>{
                if(res.data.code == 200){
                    Toast.success('修改成功');
                          this.findUserInfoa()
                }
            })
        },
        setFGet(e){
            updateGet({is_get:e}).then(res=>{
               if(res.data.code == 200){
                    Toast.success('修改成功');
                          this.findUserInfoa()
                }
            })
        }
    },
    created(){
        document.title="设置"
        this.findUserInfoa()
    }
}
</script>